<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">基础数据&nbsp;-&nbsp;套餐管理</li>
    </ol>
    
    <div class="ms-content-layout has-operation">

    <div class="ms-operation-bar no-margin no-bottom-border clearfix">
        <div class="ms-operation-group">
            <div class="pull-right">
                <a href="${ctx.host}/packages/search" data-target="#search"
                    data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i
                    class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
                </a>
            </div>
        </div>
    </div>

      <table class="table table-hover ms-table">
        <thead>
          <tr>
            <th>序号</th>
            <th>CID</th>
            <th>国家</th>
            <th>品牌</th>
            <th>付款方式</th>
            <th>套餐内容</th>
            <th>是否关闭</th>
            <th class="text-center">操作</th>
          </tr>
        </thead>
        <tbody>
        
          <c:forEach items="${sets}" var="set" varStatus="status">
            <tr>
              <td>${status.index + 1 + page.beginIndex}</td>
              <td>${set.code }</td>
              <td>${set.country.englishName} - ${set.country.chineseName}</td>
              <td>${set.supplier.engliashName} - ${set.supplier.chineseName}</td>
              <td>${set.payType.description}</td>
              <td>${set.getContentString()}</td>
              <c:choose>
	            <c:when test="${set.status.open}">
	        	  <td>否</td>
	        	</c:when>
	        	<c:otherwise>
	        	  <td>是</td>
	        	</c:otherwise>
	          </c:choose>
              <td class="text-center">
                <c:if test="${set.status.open}">
                	<a href="${ctx.host}/packages/${set.id}/close" data-target="#close" data-toggle="modal">关闭</a>&nbsp;&nbsp;
                </c:if>
                <c:if test="${set.status.close}">
                	<a href="${ctx.host}/packages/${set.id}/open" data-target="#open" data-toggle="modal">打开</a>&nbsp;&nbsp;
                </c:if>
              </td>
            </tr>
          </c:forEach>
          
        </tbody>
		<tfoot>
	        <tr>
	            <td colspan="10" class="no-vertical-padding">
	                <div class="pull-left">
	                    <jsp:include page="/WEB-INF/include/page.jsp">
	                        <jsp:param name="url" value="${ctx.host}/packages" />
	                        <jsp:param name="queryString" value="${queryString}"/>
	                    </jsp:include>
	                </div>
	            </td>
	        </tr>
          </tfoot>
      </table>

    </div>
  </div> 

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/data/package.js" />
  <script type="text/javascript">
      require([ 'page/data/package-list' ], function(page) {
          page.init()
      })
  </script>
</body>
</html>